package cn.edu.scnu.thewonderofink.ui.home

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.switchMap
import cn.edu.scnu.thewonderofink.logic.Repository

class HomeViewModel : ViewModel() {

    private val baseLiveData = MutableLiveData<String>()

    /**
     * 获取验证结果
     */
    val recognitionLiveData =  baseLiveData.switchMap  {image ->
        Repository.getResponse(image)
    }

    /**
     * 设置图片数据
     */
    fun recognitionImage(image: String){
        baseLiveData.value = image
    }

}